/*
 * dsm_list.c
 *
 *  Created on: 28 nov. 2013
 *      Author: praaa
 */

#ifndef DSM_LIST_H_
#define DSM_LIST_H_
#include <sys/socket.h>
#include <sys/types.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <poll.h>



struct s_machine{

	char* machinename;
	int num_port;
	int taille_machine;
	pid_t pid;


	struct s_machine *next;


};

struct t_machine_list{

	struct s_machine * head_list;
	struct s_machine * end_list;

};


typedef struct s_machine * t_machine;
typedef struct s_machine   s_machine;
typedef struct t_machine_list *t_machine_list;

t_machine new_machine(char * machinename,int num_port,pid_t pid);

void set_next(t_machine machine_prev, t_machine machine_next);

void set_s_machine(t_machine machine,char * name_machine, int num_port,pid_t pid,int taille_machine);

int is_empty(const t_machine_list  l);
t_machine_list new_t_machine_list();
//void free_t_machine_list(t_machine_list  l);
void add_t_machine_list(t_machine_list  l, char * name_machine,int num_port,pid_t pid);
//void free_t_machine_list_machine(t_machine machine);
//void remove_head(t_machine_list l);
//void free_machine_from_list(t_machine machine);
void list_display(t_machine_list list);
char* get_name(t_machine machine);
int get_length(t_machine machine);
int get_port(t_machine machine);
pid_t get_pid(t_machine machine);
t_machine machine_from_end_list(t_machine_list list);
t_machine machine_from_head_list(t_machine_list list);
t_machine find_machine_name(t_machine_list list, char * name);
#endif /* DSM_LIST_H_ */
